package ${packageName};

import android.arch.lifecycle.Observer;
import android.databinding.Observable;
import android.os.Bundle;
import android.support.annotation.Nullable;

import ${applicationPackage}.BR;
import ${applicationPackage}.R;
import ${applicationPackage}.databinding.${underscoreToCamelCase(layoutName)}Binding;
import ${packageName}.viewModel.${viewModelName};
import ${packageName}.item.${itemViewModelName};

import me.goldze.mvvmhabit.base.BaseActivity;

/**
 * ${activityLabel}
 */
public class ${activityClass} extends BaseActivity<${underscoreToCamelCase(layoutName)}Binding,${viewModelName}> {

    
	@Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.${layoutName};
    }

    @Override
    public void initParam() {
        super.initParam();
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        //请求网络数据
        viewModel.requestNetWork();
    }

    @Override
    public void initViewObservable() {
        //监听下拉刷新完成
        viewModel.uc.finishRefreshing.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
            @Override
            public void onPropertyChanged(Observable observable, int i) {
                //结束刷新
                binding.twinklingRefreshLayout.finishRefreshing();
            }
        });
        //监听上拉加载完成
        viewModel.uc.finishLoadMore.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
            @Override
            public void onPropertyChanged(Observable observable, int i) {
                //结束刷新
                binding.twinklingRefreshLayout.finishLoadmore();
            }
        });
        //监听长按事件条目
        viewModel.clickItemLiveData.observe(this, new Observer<${itemViewModelName}>() {
            @Override
            public void onChanged(@Nullable final ${itemViewModelName} itemViewModel) {

            }
        });
    }
}
